package info.motteke.mixivoice4j.http.json.entry.delete;

import info.motteke.mixivoice4j.Entry;
import info.motteke.mixivoice4j.http.json.JsonRequestBuilder;

public class DeleteEntryBuilder extends JsonRequestBuilder<DeleteEntryRequest> {
    private Entry entry = null;

    private String postKey = null;

    protected DeleteEntryBuilder() {

    }

    public DeleteEntryBuilder entry(Entry entry) {
        this.entry = entry;
        return this;
    }

    public DeleteEntryBuilder postKey(String postKey) {
        this.postKey = postKey;
        return this;
    }

    @Override
    public DeleteEntryRequest build() {
        check(entry, "entry");
        check(postKey, "postKey");

        DeleteEntryRequest req = new DeleteEntryRequest();
        DeleteEntryParam p = req.getParams();
        p.setMemberId(entry.getUser().getId());
        p.setPostTime(entry.getId());
        p.setAuthKey(postKey);

        return req;
    }
}